//导入vue核心包
//凡是使用npm安装的包 引入的时候都不需要写性对路径 只需要写包名即可
import Vue from 'vue';
import App from './App.vue';
import VueRouter from 'vue-router';
//引入 mint-ui
import mintui from 'mint-ui';
//进入 mint-ui的css文件
import 'mint-ui/lib/style.min.css';
//js 的mint组件需要按需导入
import {Toast} from 'mint-ui';
import moment from 'moment';
//样式
import '../statics/mui/css/mui.css';

//将vue-resource绑定 
import vueResource from 'vue-resource';


import VuePreview from 'vue-preview';
Vue.use(VuePreview);

Vue.use(vueResource);
//在vue中使用路由
Vue.use(VueRouter);
//使用mit-ui
Vue.use(mintui);

import vueLoading from 'vue-loading-template';
Vue.component('vue-loading',vueLoading)
Vue.filter('datefmt',function(input,fmtstring){
    return moment(input).format(fmtstring)
})

//导入路由规则对应组件对象
import home from './components/home.vue';
import shopcar from './components/shopcar.vue';
import site from '../statics/css/site.css';
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
import photolist from './components/photo/photolist.vue';
import photoinfo from './components/photo/photoinfo.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import goodscomment from './components/goods/goodscomment.vue';


//定义路由规则
var router = new VueRouter({
    linkActiveClass:'mui-active',
    routes:[
        {path:'*',redirect:'/home'},//默认run的路径
        {path:'/home',component:home},
        {path:'/shopcar',component:shopcar},
        {path:'/news/newslist',component:newslist},
        {path:'/news/newsinfo/:id',component:newsinfo},
        {path:'/photo/photolist',component:photolist},
        {path:'/photo/photoinfo/:id',component:photoinfo},
        {path:'/goods/goodslist',component:goodslist},
        {path:'/goods/goodsinfo/:id',component:goodsinfo},
        {path:'/goods/goodsdesc/:id',component:goodsdesc},
        {path:'/goods/goodscomment/:id',component:goodscomment}
    ]
})
//这里是接续渲染组件的
new Vue({
    el:'#app',
    router,
    // render:function(create){return create(App)}
    render:c=>c(App)//es6 函数写法 指定一个要渲染的组件
})